package be.vdab.web;

import javax.validation.constraints.NotNull;

import be.vdab.constraints.Postcode;

class VanTotPostcodeForm {
	@NotNull
	@Postcode
	private int vanpostcode;
	@NotNull
	@Postcode
	private int totpostcode;

	VanTotPostcodeForm(){}
	VanTotPostcodeForm(int vanpostcode, int totpostcode){
		this.vanpostcode = vanpostcode;
		this.totpostcode = totpostcode;
	}
	public int getVanPostcode(){
		return vanpostcode;
	}
	public int getTotPostcode(){
		return totpostcode;
	}
	
	public boolean isValid() {
		  if ((Integer)vanpostcode == null|| (Integer)totpostcode == null) {
		    return false;
		  }
		  return vanpostcode <= totpostcode;
	} 
	
	@Override
	public String toString(){
		return vanpostcode + " - " + totpostcode;
	}
}
